
package com.jcl.core.ftp;

import com.jcl.core.constants.Constant;
import org.apache.commons.lang.builder.ToStringBuilder;

public class FtpConfig {

    private String  server;

    private Integer port;

    private String  userName;

    private String  password;

    private String  location;

    private Boolean binaryTransfer;

    private Integer tryTime;

    public FtpConfig(){

    }

    public int getIntTryTime() {

        return tryTime == null || tryTime < 1 || tryTime > 10
                                                             ? Constant.FTP_OR_MAIL_ATTEMPT_TIME
                                                             : tryTime;
    }

    public Integer getTryTime() {

        return tryTime;
    }

    public void setTryTime(Integer tryTime) {

        this.tryTime = tryTime;
    }

    @Override
    public String toString() {

        return new ToStringBuilder(this).append("server", server)
                .append("port", port).append("userName", userName)
                .append("password", password).append("location", location)
                .toString();
    }

    public Boolean isBinaryTransfer() {

        return binaryTransfer;
    }

    public void setBinaryTransfer(Boolean binaryTransfer) {

        this.binaryTransfer = binaryTransfer;
    }

    public String getServer() {

        return server;
    }

    public void setServer(String server) {

        this.server = server;
    }

    public Integer getPort() {

        return port;
    }

    public void setPort(Integer port) {

        this.port = port;
    }

    public String getUserName() {

        return userName;
    }

    public void setUserName(String userName) {

        this.userName = userName;
    }

    public String getPassword() {

        return password;
    }

    public void setPassword(String password) {

        this.password = password;
    }

    public String getLocation() {

        return location;
    }

    public void setLocation(String location) {

        this.location = location;
    }

}
